#define _GNU_SOURCE
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>

void *thread_func1(void *arg)
{
    printf("Hello from thread1 %d!\n" ,gettid());
    return NULL;
}
void *thread_func(void *arg)
{
    printf("Hello from thread2! %d\n",gettid());
    return NULL;
}

int main()
{
    pthread_t thread1;
    pthread_t thread2;
    int ret1;
    int ret2;



    ret1 = pthread_create(&thread1, NULL, thread_func, NULL);
    if (ret1 != 0)
    {
        printf("Failed to create thread: %d\n", ret1);
        return 1;
    }
    ret2 = pthread_create(&thread2, NULL, thread_func1, NULL);
    if (ret2 != 0)
    {
        printf("Failed to create thread: %d\n", ret2);
        return 1;
    }
    pthread_join(thread1, NULL);
    pthread_join(thread2, NULL);
    printf("All threads have finished.\n");
    return 0;
}